#ifndef _GLOBALDATA_H_
#define _GLOBALDATA_H_
#include<map>
#include<list>
#include<string>

class GlobalData
{
private:	
	LPVOID mapFileBase;
	LPVOID mapFileImageBase;
	LPVOID mapFileKnowledgeBase;
	LPVOID mapFileBaseorderBase;
	LPVOID mapFileHelpTxtBase;
	UINT baseFreqItemCount;
	HANDLE mapFileHandle;
	std::map<std::string,LPBYTE> baseDic;
	std::list<LPBYTE> codeList;
public:
	static UINT Setting;
private:
	VOID _loadData(BOOL reloadMapFile);
	VOID _loadBaseImg(FILE** lpFile,BOOL reloadMapFile);
	VOID _loadCode(FILE** lpFile,BOOL reloadMapFile);
	VOID _loadBaseFreq(FILE** lpFile,BOOL reloadMapFile);
	VOID _loadHelpTxt(FILE** lpFile,BOOL reloadMapFile);
	VOID _createMapFile();
	static GlobalData* pdata;
	GlobalData();
public:
	VOID Initial();
	VOID Dispose();
	LPBYTE GetBmpAddr(std::string key);
	UINT GetBaseFreq(CONST LPTSTR lpKey) CONST;
	CONST std::list<LPBYTE>* GetCodeList() CONST;
	std::wstring GetHelpTxt() CONST;
	static GlobalData* GetInstance();
	static UINT WriteKnowledge(CONST LPKNOWLEDGE lpKnowledge,LPBYTE lpAddr);
};
#endif
